<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fns" uri="http://java.sun.com/jsp/jstl/functionss" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <title>抓拍记录</title>
    <jsp:include page="../../body/link-page.jsp" flush="true"/>

</head>
<body>
<div class="panel">
    <div class="panel-heading">
        <button class="btn btn-primary" onclick="deleteAll();"><i class="fa fa-trash-o"></i>删除</button>
    </div>

    <form id="form" action="/car/capture/list" method="post">
        <div class="panel-body">
            <div id="demo-dt-addrow_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
                <div class="newtoolbar">
                    <div id="demo-custom-toolbar2" class="table-toolbar-left">
                    </div>
                </div>
            </div>
            <table id="table" class="table table-striped table-bordered dataTable no-footer dtr-inline"
                   cellspacing="0" width="100%" role="grid" aria-describedby="demo-dt-addrow_info"
                   style="width: 100%;"
                   data-pn="${captureList.pageNum}" data-ps="${captureList.pageSize}" data-tp="${captureList.totalPage}"
                   data-tr="${captureList.totalRecord}">
                <thead>
                <tr role="row">
                    <th style="width: 20px;"><input type="checkbox" id="check-all"/></th>
                    <th>车牌号</th>
                    <th>预约状态</th>
                    <th>设备编号</th>
                    <th>抓拍状态</th>
                    <th>抓拍时间</th>
                    <th>备注</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach var="capture" items="${captureList.results}" varStatus="status">
                    <tr role="row" class="odd">
                        <td><input type="checkbox" value="${capture.id}"/></td>
                        <td>${capture.plate}</td>
                        <td>
                            <c:if test="${capture.type==0}">未预约</c:if>
                            <c:if test="${capture.type==1}">已预约</c:if>
                        </td>
                        <td>${capture.equip}</td>
                        <td>
                            <c:if test="${capture.status==0}">进门拍照</c:if>
                            <c:if test="${capture.status==1}">出门拍照</c:if>
                        </td>
                        <td>${fns:dateToStringTime(capture.time)}</td>
                        <td>${capture.intro}</td>
                    </tr>

                </c:forEach>
                </tbody>
            </table>
            <ul class="pagination"></ul>
        </div>

    </form>
</div>
</body>
<jsp:include page="../../body/javascript-page.jsp" flush="true"/>
<script type="application/javascript">
    function  deleteAll(){
        var  ids=getAllCheck("form");
        if(ids.length <=0){
            layer.msg("请选择删除的数据",{icon:0,timeout:1000});
        }else{
            layer.confirm("确定要删除" + ids.length + "条数据？",{title:"提示",btn:["确定","取消"]},function () {
                $.ajax({
                    type:"POST",
                    url:"/car/capture/deleteDataByIds",
                    dataType:"json",
                    data:{"ids":ids.join(",")},
                    success:function (data) {
                        if(data.success){
                            layer.msg("删除成功",{icon:1,timeout:1000});
                            reloadPage();
                        } else {
                            layer.msg("删除失败",{icon:2,timeout:1000});
                        }
                    }
                    });
            });
        }
     }
</script>
</html>
